-- electricity
-- created by cheny3
-- 电磁场力
-- condition中直接传入prop，需要key、value可以直接替换进描述

return {
    fetchProps = function(who, status, condition)
        local props = {};
        local prop = table.deepcopy(condition["prop"] or {});

        if #prop <= 0 then
            return props;
        end

        table.insert(props, prop);

        return props;
    end,

    desc = function(who, status, condition)
        -- 获取状态描述
        local cfg = CombatStatusM.getStatusInfo(status);
        local desc = cfg.desc;

        local prop = table.deepcopy(condition["prop"] or {});
        local propId = prop[1];

        local value = PropM.combine(who, "electricity", 1)[3];

        -- 玩家降低电磁力场效果
        local co = 1000;
        local prop2 = PropM.combine(who, "reduce_electricity", 1);
        if prop2[3] > 0 then
            co = 1000 - prop2[3];
        end
        value = FormulaM.invoke("CALC_BIG_DIVISION", value, co, 1000);

        -- 1%保底
        if value > 0 then
            value = math.max(10, value);
        end

        if PropM.query(propId, "type") == PROP_TYPE_RATIO then
            -- 显示为百分比的
            value = math.modf(value / 10);
        end

        desc = string.gsub(desc, "{value}", value);

        return desc;
    end,
};
